home *** CD-ROM | disk | FTP | other *** search
/ Aminet 33 / Aminet 33 - October 1999.iso / Aminet / util / misc / VMM_src.lha / VMM / mmu_bits30.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-10  |  2.8 KB  |  128 lines

  1. /* Descriptor field types */
  2. #define DT_INVALID            0L
  3. #define DT_PAGE_DESCRIPTOR    1L
  4. #define DT_VALID4BYTE        2L
  5. #define DT_VALID8BYTE        3L
  6.  
  7. /* TC */
  8. #define TC_E            31
  9. #define TC_SRE            25
  10. #define TC_FCL         24
  11. #define TC_PS_END     23
  12. #define TC_PS_START  20
  13. #define TC_IS_END        19
  14. #define TC_IS_START    16
  15. #define TC_TIA_END    15
  16. #define TC_TIA_START    12
  17. #define TC_TIB_END    11
  18. #define TC_TIB_START     8
  19. #define TC_TIC_END     7
  20. #define TC_TIC_START     4
  21. #define TC_TID_END     3
  22. #define TC_TID_START     0
  23.  
  24. /* CRP / SRP */
  25. #define RP_LU                63
  26. #define RP_LIMIT_END        62
  27. #define RP_LIMIT_START    48
  28. #define RP_DT_END            33
  29. #define RP_DT_START        32
  30. #define RP_TA_END            31
  31. #define RP_TA_START         4
  32.  
  33. /* TT0 / TT1 */
  34. #define TT_LAB_END        31
  35. #define TT_LAB_START        24
  36. #define TT_LAM_END        23
  37. #define TT_LAM_START        16
  38. #define TT_E                15
  39. #define TT_CI                10
  40. #define TT_RW                 9
  41. #define TT_RWM                 8
  42. #define TT_FCB_END         6
  43. #define TT_FCB_START         4
  44. #define TT_FCM_END         2
  45. #define TT_FCM_START         0
  46.  
  47. /* MMUSR */
  48. #define SR_B            15
  49. #define SR_L            14
  50. #define SR_S            13
  51. #define SR_W            11
  52. #define SR_I            10
  53. #define SR_M             9
  54. #define SR_T             6
  55. #define SR_N_END         2
  56. #define SR_N_START     0
  57.  
  58. /* Long table descriptor */
  59. #define LT_LU                63
  60. #define LT_LIMIT_END    62
  61. #define LT_LIMIT_START    48
  62. #define LT_S                40
  63. #define LT_U                35
  64. #define LT_WP                34
  65. #define LT_DT_END            33
  66. #define LT_DT_START        32
  67. #define LT_TA_END            31
  68. #define LT_TA_START         4
  69.  
  70. /* Short table descriptor */
  71. #define ST_TA_END        31
  72. #define ST_TA_START     4
  73. #define ST_U             3
  74. #define ST_WP              2
  75. #define ST_DT_END         1
  76. #define ST_DT_START     0
  77.  
  78. /* Page descriptor */
  79. #define PA_PA_END            31
  80. #define PA_PA_START        8
  81. #define PA_CI                6
  82. #define PA_M                4
  83. #define PA_U                3
  84. #define PA_WP                2
  85. #define PA_DT_END            1
  86. #define PA_DT_START        0
  87.  
  88. /* Illegal descriptor */
  89. #define IL_DT_END            1
  90. #define IL_DT_START        0
  91.  
  92. /* Definitionen für neue MMU-Tabelle */
  93. #define SEGMENT( adr, segmentSize ) ( (adr) & ~((segmentSize)-1) )
  94. #define MAKE_MASK( from, to, val ) ( (ULONG)( (val) << (from) ) )
  95. #define VAL32(val, from, to) (((val) >> (from)) & ((1L<<((to)-(from)+1))-1))
  96. #define VAL64(val, from, to) (((from) >= 32) ? \
  97.                VAL32 (val.hi,(from)&0x1f,(to)&0x1f) :\
  98.                VAL32 (val.lo,(from)&0x1f,(to)&0x1f))
  99.  
  100. typedef enum { ML_A, ML_B, ML_C, ML_D } MMULevels;
  101.  
  102. #define TABLE_ADDRESS_SHIFT 4
  103. #define TABLE_ADDRESS_ALIGNMENT (1L<<TABLE_ADDRESS_SHIFT)
  104.  
  105. #define PAGE_ADDRESS_SHIFT 8
  106. #define PAGE_ADDRESS_ALIGNMENT (1L<<PAGE_ADDRESS_SHIFT)
  107.  
  108. #define LEVEL_A_BITS    7
  109. #define LEVEL_B_BITS    7
  110.  
  111. #if PAGESIZE==4096
  112. #define LEVEL_C_BITS    6
  113. #define PAGE_BITS        12
  114. #endif
  115.  
  116. #if PAGESIZE==8192
  117. #define LEVEL_C_BITS    5
  118. #define PAGE_BITS        13
  119. #endif
  120.  
  121. /* Bit-Operationen */
  122. #define SET(word,bit) ((word) |=  (1 << (bit)))
  123. #define CLR(word,bit) ((word) &= ~(1 << (bit)))
  124. #define TST(word,bit) ( ((word) >> (bit)) & 1 )
  125.  
  126. typedef ULONG Reg32;
  127. typedef struct {    ULONG hi; ULONG lo; } Reg64;
  128.